﻿using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Base.Structure.MessageQueue
{
    /// <summary>
    /// 消息生产者实现
    /// </summary>
    public class MessageProducer : IMessageProducer
    {
        private readonly IConnection _connection;
        //private readonly IModel _channel;

        public MessageProducer()
        {
            var factory = new ConnectionFactory() { HostName = "localhost" };
            //_connection = factory.CreateConnection();
            //_channel = _connection.CreateModel();
            //_channel.QueueDeclare(queue: "task_queue", durable: true, exclusive: false, autoDelete: false, arguments: null);
        }

        public void SendMessage(string message)
        {
            var body = Encoding.UTF8.GetBytes(message);
            //_channel.BasicPublish(exchange: "", routingKey: "task_queue", basicProperties: null, body: body);
        }
    }
}
